package com.sinosoft.dsp.system.to;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.w3c.dom.Node;

import com.sinosoft.dsp.system.core.exception.SinoException;
import com.sinosoft.dsp.system.to.attribute.Attribute;
import com.sinosoft.dsp.system.to.exception.SinoAttributeException;
import com.sinosoft.dsp.system.to.exception.SinoAttributeValidationException;

public class RowTO implements IBaseTO {

	public static final String XML_META_TAG = "row-meta";
	public static final String XML_DATA_TAG = "row-data";

	private List<Attribute<?>> attributeList;

	public RowTO() {
		attributeList = new ArrayList<Attribute<?>>();
	}

	/**
	 * 克隆对象
	 */
	public RowTO cloneTO() throws SinoAttributeException {
		RowTO rowTO = new RowTO();
		for (int i = 0; i < size(); i++) {
			Attribute<?> attr = getAttributeByIndex(i);
			rowTO.add(attr.cloneAttribute());
		}
		return rowTO;
	}

	public String toString() {
		StringBuffer buffer = new StringBuffer();
		for (int i = 0; i < size(); i++) {
			if (i > 0)
				buffer.append(", ");
			buffer.append("[");
			buffer.append(getAttributeByIndex(i).toString());
			buffer.append("]");
		}
		return buffer.toString();
	}

	public int size() {
		return attributeList.size();
	}

	public boolean isEmpty() {
		return size() == 0;
	}

	@Override
	public IBaseTO add(Attribute<?> attribute) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Attribute<?>[] cloneAttributes() throws SinoAttributeException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int compare(Attribute<?>[] attr, int[] attrnrs)
			throws SinoAttributeException {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public boolean equals(Attribute<?>[] attr, int[] attrnrs)
			throws SinoAttributeException {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean exists(Attribute<?> meta) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public Attribute<?> getAttributeByIndex(int index) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<String> getAttributeNames() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Attribute<?>> getAttributes() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public IBaseTO getByNode(Node node) throws SinoException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getMetaXML() throws IOException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int getNumberOfAttributes() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public Attribute<?> remove(String name) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Attribute<?> remove(int index) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public IBaseTO set(int index, Attribute<?> attribute)
			throws SinoAttributeException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String toStringMeta() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public IBaseTO validate() throws SinoAttributeValidationException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Attribute<?> getAttributeByName(String name) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int indexOf(String name) {
		// TODO Auto-generated method stub
		return 0;
	}

}
